﻿<%@ Page Title="" Language="C#" MasterPageFile="~/ECGSite.Master" AutoEventWireup="true"
    CodeBehind="PatientPage.aspx.cs" Inherits="ECGWeb.WebForm1" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="~/Controls/ToolBox.ascx" TagName="toolBox" TagPrefix="uc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="childContent" runat="server">
    <script src="Scripts/jquery-1.7.2.js" type="text/javascript"></script>
    <link href="Style/PageStyle.css" rel="stylesheet" type="text/css" />
    <link href="Style/TableStyle.css" rel="stylesheet" type="text/css" />
    <link href="Style/PatientPage.css" rel="stylesheet" type="text/css" />
    <script src="Scripts/contentSlideToggle.js" type="text/javascript"></script>
    <script src="Scripts/myDrawGraph.js" type="text/javascript"></script>
    <script src="Scripts/patientPageScript.js" type="text/javascript"></script>
    <script type="text/javascript">
        //Đổi màu nút bấm menu
        $(window).load(function () {
            $('#tc_patientpage').css({ 'background-color': '#6BBBE5' });
        });

        var dataArr;
        var offset;
        var check;
        var columnCheck;
        var newLeadLength;
        var oldLeadLength;
        var oldMaxX;
        var newMaxX;
        var request = null;
        var haveAnOtherRequest = false;
        //Sự kiện khi click một dòng của gridview
        //Dùng pageLoad() thay vì $(document).ready() vì sau khi postback thì không còn  
        //nhận được sự kiện click nữa do bị hủy các đối tượng DOM
        function pageLoad() {
            $('.RowStyle').click(function () {
                //Dịch trang đến vị trí vẽ
                $('html, body').animate({
                    scrollTop: $("#recordDetail").offset().top
                }, 800);
                recordid = $(this).children().eq(0).html()
                haveAnOtherRequest = true;
                //loadData12(recordid);

                //Thu nghiem load tung phan
                if (request != null) {
                    var executor = request.get_executor();
                    if (executor.get_started()) {
                        executor.abort();
                    }
                }
                loadAFrame(recordid);
            });
        }        
    </script>
    <div class="item">
        <div class="div_head">
            Thông tin bệnh nhân</div>
        <hr noshade size="4" class="horizon_line" />
        <div class="div_content">
            <table border="0" width="500px">
                <tr>
                    <td colspan="2">
                        Họ tên: <b>
                            <asp:Label ID="lbPatientName" runat="server" CssClass="asp_infoLabel"></asp:Label></b>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        Mã bệnh nhân: <b>
                            <asp:Label ID="lbPatientID" runat="server" CssClass="asp_infoLabel"></asp:Label></b>
                    </td>
                </tr>
                <tr>
                    <td>
                        Ngày sinh: <b>
                            <asp:Label ID="lbBirthDay" runat="server"></asp:Label></b>
                    </td>
                    <td>
                        Giới tính: <b>
                            <asp:Label ID="lbSex" runat="server"></asp:Label>
                    </td>
                    </b>
                </tr>
                <tr>
                    <td>
                        Nghề nghiệp: <b>
                            <asp:Label ID="lbCareer" runat="server"></asp:Label></b>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        Địa chỉ: <b>
                            <asp:Label ID="lbAddress" runat="server"></asp:Label></b>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        Điện thoại liên hệ: <b>
                            <asp:Label ID="lbPhone" runat="server"></asp:Label></b>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <div class="item">
        <div class="div_head">
            Lịch sử đo điện tim</div>
        <hr noshade size="4" class="horizon_line" />
        <div class="div_content">
            <asp:UpdatePanel ID="updatePanel1" runat="server">
                <Triggers>
                </Triggers>
                <ContentTemplate>
                    <asp:Label Text="Lọc bản ghi" runat="server"></asp:Label>
                    <br />
                    <table width="500px">
                        <tr>
                            <td>
                                <asp:Label ID="Label1" Text="Từ ngày: " runat="server"></asp:Label>&nbsp;
                                <asp:TextBox ID="fromDateTxtBox" runat="server" AutoPostBack="true" OnTextChanged="fromDateTxtBox_TextChanged"></asp:TextBox>
                                <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="fromDateTxtBox">
                                </asp:CalendarExtender>
                            </td>
                            <td>
                                <asp:Label ID="Label2" Text="Đến ngày: " runat="server"></asp:Label>&nbsp;
                                <asp:TextBox ID="toDateTxtBox" runat="server" AutoPostBack="true" OnTextChanged="toDateTxtBox_TextChanged"></asp:TextBox>
                                <asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="toDateTxtBox">
                                </asp:CalendarExtender>
                            </td>
                            <td>
                                <asp:Label ID="notifyLbl" Text="" runat="server" ForeColor="Red"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>
            <br />
            <br />
            <asp:UpdatePanel ID="updatePanel2" runat="server">
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="gridview1" EventName="pageindexchanging" />
                </Triggers>
                <ContentTemplate>
                    <div class="patient_gridview_div">
                        <asp:GridView ID="gridview1" runat="server" AllowPaging="true" ClientIDMode="Static"
                            AllowSorting="true" CssClass="GridViewStyle" GridLines="None" PageSize="5" AutoGenerateColumns="false"
                            OnPageIndexChanging="gridview1_PageIndexChanging">
                            <Columns>
                                <asp:BoundField DataField="RecordID" HeaderText="Mã bản ghi" />
                                <asp:BoundField DataField="DateTimeOfRecord" HeaderText="Ngày giờ" />
                                <%--<asp:TemplateField>
                                    <ItemTemplate>
                                       <input class="detailBtn" type="button" value="Xem chi tiết" onclick="loadData12('<%# Eval("RecordID")%>')"/>
                                    </ItemTemplate>
                                </asp:TemplateField> --%>
                            </Columns>
                            <RowStyle CssClass="RowStyle" />
                            <EmptyDataRowStyle CssClass="EmptyRowStyle" />
                            <PagerStyle CssClass="PagerStyle" />
                            <SelectedRowStyle CssClass="SelectedRowStyle" />
                            <HeaderStyle CssClass="HeaderStyle" />
                            <EditRowStyle CssClass="EditRowStyle" />
                            <AlternatingRowStyle CssClass="RowStyle" />
                        </asp:GridView>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>
    <%--<script type="text/javascript">
          //        function GotIndex() {
          //  alert("<%= this.gridview1.SelectedIndex %>");
          //        }
          $(".test").click(function () {
              alert($(this).attr('idtable'));
          });
    </script>--%>
    <div class="item">
        <div class="div_head">
            Chi tiết lịch sử đo</div>
        <hr noshade size="4" class="horizon_line" />
        <div class="div_content" id="recordDetail">
            <table>
                <tr>
                    <td>
                        Mã bản ghi: <b>
                            <label id="lbRecordID">
                            </label>
                        </b>
                    </td>
                </tr>
                <tr>
                    <td>
                        Tổng thời gian đo:
                        <asp:Label ID="lbTotalTime" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        Từ:
                        <asp:Label ID="lbFromTime" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        Đến:
                        <asp:Label ID="lbToTime" runat="server"></asp:Label>
                    </td>
                </tr>
            </table>
            <br />
            <p>
                <label id="timeLabel">
                </label>
            </p>
            <div id="continueLoadingImg_div" style="visibility:hidden">
                <img src="Images/continueLoading.gif" />
            </div>
            <div id="timeline">
                + 0s
            </div>
            <table>
                <tr>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">I</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="I">
                                <canvas class="ecgCanvas" id="canvasI"> </canvas>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">aVR</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="aVR">
                                <canvas class="ecgCanvas" id="canvasaVR"> </canvas>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">V1</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="V1">
                                <canvas class="ecgCanvas" id="canvasV1"> </canvas>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">V4</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="V4">
                                <canvas class="ecgCanvas" id="canvasV4"> </canvas>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">II</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="II">
                                <canvas class="ecgCanvas" id="canvasII"> </canvas>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">aVL</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="aVL">
                                <canvas class="ecgCanvas" id="canvasaVL"> </canvas>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">V2</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="V2">
                                <canvas class="ecgCanvas" id="canvasV2"> </canvas>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">V5</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="V5">
                                <canvas class="ecgCanvas" id="canvasV5"> </canvas>
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">III</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="III">
                                <canvas class="ecgCanvas" id="canvasIII"> </canvas>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">aVF</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="aVF">
                                <canvas class="ecgCanvas" id="canvasaVF"> </canvas>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">V3</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="V3">
                                <canvas class="ecgCanvas" id="canvasV3"> </canvas>
                            </div>
                        </div>
                    </td>
                    <td>
                        <div class="canvasDiv_Wrapper">
                            <span class="lead_name_div">V6</span>
                            <center>
                                <div style="margin-top: 40px" class="loadingimage_div" hidden="true">
                                    <img src="Images/loading.gif" /></div>
                            </center>
                            <div class="canvas_div" id="V6">
                                <canvas class="ecgCanvas" id="canvasV6"> </canvas>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
            <uc:toolBox ID="toolBoxDiv" runat="server" />
            <p>
                Các thông số đo:</p>
            <p>
                ----------------------------------------------------------</p>
            <p>
                ----------------------------------------------------------</p>
            <p>
                ----------------------------------------------------------</p>
        </div>
    </div>
</asp:Content>
